#!/usr/bin/python env
# -*- coding: utf-8 -*-
from fabric.context_managers import lcd
from fabric.operations import local
from fabric.api import env, cd, sudo, run, put, settings, task, roles, execute
import time

env.roledefs = {
    'test': ['admin@127.0.0.1'],

    'registry': ['admin@172.16.0.16'],
    'adminlog': ['admin@172.16.0.9'],

    'service': ['admin@172.16.0.2', 'admin@172.16.0.3'],
    'service1': ['admin@172.16.0.2'],
    'service2': ['admin@172.16.0.3']
}
modules = {
    'registry': ['registry-center'],
    'adminlog': ['admin-system', 'log-service'],
    'service': ['api-gateway', 'user-service', 'task-service']
}
basePath = '/home/admin/app'
active='pro'


@roles('test')
def log_test(module='user-service'):
    run('tail -f ' + basePath + '/log/' + module + '.log')

@roles('service1')
def log_service1(module='user-service'):
    run('tail -f ' + basePath + '/log/' + module + '.log')

@roles('service2')
def log_service1(module='user-service'):
    run('tail -f ' + basePath + '/log/' + module + '.log')


@roles('adminlog')
def log_adminlog(module='admin-system'):
    run('tail -f ' + basePath + '/log/' + module + '.log')


@roles('registry')
def log_registry(module='registry-center'):
    run('tail -f ' + basePath + '/log/' + module + '.log')

